/*
 * @Author: toString muzi_li0323@163.com
 * @Date: 2024-05-22 16:44:13
 * @LastEditors: toString
 * @LastEditTime: 2024-07-27 16:53:00
 * @FilePath: /token-for-token-front/src/require/require.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import axios from "axios";
// import { useRouter } from "vue-router";
// import { useUserStore } from "@/stores";
// const userStore= useUserStore();
// const router = useRouter();
// const baseURL = 'http://192.168.0.116:8848/api';
// const baseURL = 'http://localhost:8848/api';
// const baseURL = 'https://vip.skysp.info/api';
const baseURL = import.meta.env.VITE_BASE_URL + '/api/';
// const baseURL = 'https://clapi.wwwrfs.com/api'; // 最新域名

const ins = axios.create({
    baseURL,
    timeout: 50000,
});


// 设置 请求拦截
ins.interceptors.request.use((config) => {
    // config.headers.language = userStore.getLocale;
    // let token = userStore.getToken;
    // if (token) {
    //     config.headers.Authorization = token
    // }
    return config;
}, (err) => {
    return Promise.reject(err);
});

// 设置响应拦截
ins.interceptors.response.use((res) => {
    // console.log('响应拦截');
    res = res.data;
    return res;
}, (err) => {
    return Promise.reject(err);
})

export default ins;
